# 同样的，请求头也是可以 Pydantic Model 的，貌似 swagger 测试不了，可能需要 postman 之类的，以后再说

from typing import Annotated

from fastapi import FastAPI, Header
from pydantic import BaseModel

app = FastAPI()


class CommonHeaders(BaseModel):
    host: str | None = None
    save_data: bool | None = None
    if_modified_since: str | None = None
    traceparent: str | None = None
    x_tag: list[str] = []


@app.get("/items/")
async def read_items(headers: Annotated[CommonHeaders, Header()]):
    return headers
